<?php
$sql = "
    CREATE TABLE IF NOT EXISTS `ims_goouc_class_syslog` (
			  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			  `weid` int(11) DEFAULT NULL ,
			  `admin_uid` int(11) DEFAULT NULL ,
			  `admin_username` varchar(50) DEFAULT NULL ,
			  `log_type` tinyint(1) DEFAULT NULL COMMENT '操作类型 1.增加 2.删除 3更新',
			  `function` varchar(100) DEFAULT NULL ,
			  `content` varchar(1000) DEFAULT NULL ,
			  `ip` varchar(50) DEFAULT NULL  ,
			  `addtime` int(10) NOT NULL ,	
			  PRIMARY KEY (`id`),
        	  KEY `idx_weid` (`weid`)
		) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='操作日志';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_module` (
			  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			  `weid` int(11) DEFAULT NULL ,
			  `name` varchar(255) NOT NULL,
			  `image` varchar(255) NOT NULL COMMENT '模块缩略图',
			  `order` int(10) default 0 COMMENT '排序 数字越大排序越靠前',
			  `num` int(10) default 0 COMMENT '显示课程数',
			  `status` tinyint(1) default 0 COMMENT '状态 0为不显示  1为显示',
			  `addtime` int(11) NOT NULL,
			  PRIMARY KEY (`id`),
        	  KEY `idx_weid` (`weid`)
		) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '推荐模块';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_city`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`name` varchar(255) NOT NULL COMMENT '城市名称',
			`order` int(10) DEFAULT 0 COMMENT '排序 数字越大排序越靠前',
			`status` tinyint(1) DEFAULT 1 COMMENT '城市状态，默认显示',
			`address` varchar(255) DEFAULT NULL,
			`tel` varchar(20) DEFAULT NULL,
			`qq` int(11) DEFAULT NULL,
			`image` varchar(255) DEFAULT null,
			`description` text DEFAULT null,
			`addtime` int(11) NOT NULL,
			PRIMARY KEY (`id`),
      		KEY `idx_weid` (`weid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '城市';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_class`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`name` varchar(255) NOT NULL COMMENT '班期名称',
			`subjectid` varchar(255) DEFAULT NULL COMMENT '学科ID的字符串 班期关联学科',
			`order` int(10) DEFAULT 0 COMMENT '排序 数字越大排序越靠前',
			`status` tinyint(1) DEFAULT 1 COMMENT '城市状态，默认显示',
			`addtime` int(11) NOT NULL,
      		`classyear` tinyint(1) DEFAULT 1 COMMENT '默认学年为小学',
			PRIMARY KEY (`id`),
      		KEY `idx_weid` (`weid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '班期';
	
	CREATE TABLE IF NOT EXISTS `ims_goouc_class_subject`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`name` varchar(255) NOT NULL COMMENT '班期名称',
			`order` int(10) DEFAULT 0 COMMENT '排序 数字越大排序越靠前',
			`status` tinyint(1) DEFAULT 1 COMMENT '学科状态，默认显示',
			`addtime` int(11) NOT NULL,
			PRIMARY KEY (`id`),
      		KEY `idx_weid` (`weid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '学科';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_semester`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`name` varchar(255) NOT NULL COMMENT '学期名称',
			`status` tinyint(1) DEFAULT 1 COMMENT '学期状态，默认显示',
			`addtime` int(11) NOT NULL,
			PRIMARY KEY (`id`),
      		KEY `idx_weid` (`weid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '学期';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_voidtype`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`name` varchar(255) NOT NULL COMMENT '学期名称',
			`status` tinyint(1) DEFAULT 1 COMMENT '学期状态，默认显示',
			`addtime` int(11) NOT NULL,
			PRIMARY KEY (`id`),
      		KEY `idx_weid` (`weid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '视频类型';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_teacher`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`name` varchar(255) NOT NULL COMMENT '讲师名称',
			`headimg` varchar(255) NOT NULL COMMENT '老师头像',
			`desc` text NOT NULL COMMENT '老师简介',
			`subjectid` int(11) NOT NULL COMMENT '讲师学科ID',
			`cityid` int(11) NOT NULL COMMENT '讲师城市一对一',
			`order` int(10) default 0,	
			`status` tinyint(1) DEFAULT 1 COMMENT '讲师状态，默认显示',
			`addtime` int(11) NOT NULL,
			`mobile`  varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号' ,		
			PRIMARY KEY (`id`),
      		KEY `idx_weid` (`weid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '讲师多对多';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_lesson`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`title` varchar(255) NOT NULL COMMENT '课程标题',
			`teacherid` int(11) NOT NULL COMMENT '讲师ID',
			`image` varchar(255) NOT NULL COMMENT '封面图片 PC 需要',
			`moduleid` int(10) default NULL COMMENT '推荐模块id',	
			`voidtypeid` int(11) default NULL COMMENT '课程类型id',
			`semesterid` int(11) default NULL COMMENT '学期id',
			`cityid` int(11) default NULL COMMENT '城市id',
			`yearid` int(11) default NULL COMMENT '年份id',
			`classid` varchar(255) default NULL COMMENT '班期id 数组',
			`subjectid` int(11) default NULL COMMENT '学科id',
			`order` int(11) default 0 COMMENT '排序默认为0 越大越靠前',
			`status` tinyint(1) default 0 comment '默认下架',
			`addtime` int(11) NOT NULL,
			`pay_money` decimal(10,2) DEFAULT '0.00' COMMENT '课程价格',
			`pay_num` int(11) DEFAULT 0 COMMENT '已购买人数',
			`old_money` decimal(10,2) DEFAULT 0.00,
			`study_num` int(11) DEFAULT 0,
			`free_num` int(11) DEFAULT 0,
			`pc_description` longtext DEFAULT NULL,
			`free_son_id` VARCHAR(255) DEFAULT NULL,
			`fic_pay_num` int(11) DEFAULT 0,
			`fic_study_num` int(11) DEFAULT 0,
      		`desc` text DEFAULT NULL COMMENT '课程简介 区别于课程介绍',
	      	`recommend` tinyint(4) DEFAULT 0 COMMENT '课程是否被推荐',
	      	`qrcode` varchar(255) DEFAULT NULL COMMENT '每个课程的静态码',
	      	`share_image` varchar(255) DEFAULT NULL COMMENT '课程分享封面图 不能为空 必须有',
	      	`classtypeid` int(11)  DEFAULT NULL COMMENT '课程班型id',
	      	`is_only` tinyint(1)  DEFAULT 2 COMMENT '1为单节课  2为系列课',
	      	`is_groupbuy` tinyint(1)  DEFAULT 2 COMMENT '是否是可以团购的课程',
	      	`help_teacherid` int(11) NOT NULL,
	      	`xhbnumber` int(11) DEFAULT NULL,
	      	`paytype` tinyint(1) DEFAULT 2,
            `is_underline` tinyint(1) DEFAULT 0,
            `pctype`  tinyint(1)  DEFAULT 0 ,

			 PRIMARY KEY (`id`),
	        KEY `idx_weid` (`weid`),
	        KEY `idx_teacherid` (`teacherid`),
	        KEY `idx_classid` (`classid`),
	        KEY `idx_subjectid` (`subjectid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '讲师多对多';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_son`(
			`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			`weid` int(11) NOT NULL,
			`lessonid` int(11) NOT NULL,
			`title` varchar(255) NOT NULL comment '章节标题',
			`type` tinyint(1) default 0 comment '是否需要使用听课券 默认不需要 为0 需要为1',
			`num` int(11) default 0 comment '已学习人数 默认为0',
			`key` varchar(255) NOT NULL comment '口令' ,
			`object` varchar(255) NOT NULL comment '口令类型' ,
			`status` tinyint(1) default 0 comment '默认下架',
			`orders` int(11) default 0 COMMENT '排序默认为0 越大越靠前',
			`image` varchar(255) DEFAULT NULL comment '封面图片' ,
			`pay_money` decimal(10,2) DEFAULT '0.00' COMMENT '章节金额',
			`pay_num` int(11) DEFAULT 0 COMMENT '已购买人数',
			`xnum` int(11) DEFAULT 0,
	        `cardnum` int(11) DEFAULT NULL COMMENT '章节需要听课券张数',
	        `vediotime` decimal(20,2) DEFAULT '0.00' COMMENT '视频时长',
	        `coverurl` varchar(255) DEFAULT NULL COMMENT '视频封面图片',
	        `updatestatus` tinyint(1) DEFAULT 0 COMMENT '是否更新过视频',
	        `starttime` int(11) default 0 COMMENT '开始上课时间',
	        `sontype` tinyint(1) DEFAULT 2 COMMENT '1为直播课程 2 为录播课程 3真直播直播中 4伪直播 5真直播直播结束',
			`vodtranscodegroupid`  varchar(255)  DEFAULT NULL ,
			`live_url`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '推流地址' ,
            `broad_url`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '播流地址' ,
            `classin_url`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'classin播流地址' ,
            `cl_courseid` int(11) DEFAULT 0 COMMENT 'classin课程id',
            `cl_classid` int(11) DEFAULT 0 COMMENT 'classin课节id',
            `url_time`  int(11) NULL DEFAULT 0 ,
            `create_url_time`  int(11) NULL DEFAULT 0 ,
			PRIMARY KEY (`id`),
     		KEY `idx_lessonid` (`lessonid`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '章节信息表';

	CREATE TABLE IF NOT EXISTS `ims_goouc_class_phonecode`(
       `id` int(11) NOT NULL AUTO_INCREMENT,
       `weid` int(11) not null,
       `phone` varchar(11) NOT NULL,
       `code` int(11) not null COMMENT '手机验证码',
       `createtime` int(11) NOT NULL,
       PRIMARY KEY (`id`),
       KEY `idx_phone` (`phone`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '手机发送验证码';

    CREATE TABLE IF NOT EXISTS  `ims_goouc_class_user` (
        `id`  int(11) UNSIGNED NOT NULL AUTO_INCREMENT ,
        `weid`  int(11) NOT NULL ,
        `openid`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
        `pc_openid`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
        `h5_openid`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
        `nickname`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信昵称' ,
        `name`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '学生姓名' ,
        `sex`  tinyint(1) NULL DEFAULT NULL COMMENT '学生性别 0为女  1为男' ,
        `phone`  varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户手机号' ,
        `city1`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '学生所在省' ,
        `city2`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '学生所在市' ,
        `school`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '就读学校' ,
        `headimg`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上传头像' ,
        `looktime`  int(11) NULL DEFAULT 0 COMMENT '用户观看视频时长' ,
        `card`  int(11) NULL DEFAULT 0 COMMENT '听课券数量' ,
        `auto`  tinyint(1) NULL DEFAULT 1 COMMENT '是否自动播放视频 默认自动播放' ,
        `sharnum`  int(11) NULL DEFAULT 0 COMMENT '分享一次获得五张听课券，每天最多获得十张' ,
        `status`  tinyint(1) NULL DEFAULT 1 COMMENT '1表示正常用户  0表示被拉黑用户' ,
        `loginstatus`  tinyint(1) NULL DEFAULT 0 COMMENT '登录状态  1 已登录 0未登录' ,
        `createtime`  int(11) NULL DEFAULT NULL COMMENT '信息变更时间' ,
        `new_status`  tinyint(1) NULL DEFAULT 0 ,
        `session_key`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
        `classid`  int(11) NULL DEFAULT NULL ,
        `qrcode`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户个人二维码' ,
        `myheaderimg`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户自定义头像' ,
        `teacherid`  int(11) NULL DEFAULT 0 COMMENT '教师表关联id' ,
        `type`  tinyint(1) NULL DEFAULT 1 COMMENT '1：学生   2：老师' ,
        `unionId`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
        PRIMARY KEY (`id`),
        INDEX `idx_weid` (`weid`) USING BTREE ,        
        )
        ENGINE=InnoDB
        DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
        COMMENT='用户表'
        AUTO_INCREMENT=10
        ROW_FORMAT=COMPACT
        ;

    CREATE TABLE IF NOT EXISTS `ims_goouc_class_signin`(
        `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
        `weid` int(11) NOT NULL,
        `uid` int(255) NOT NULL COMMENT '用户签到标识',
        `num` int(11) DEFAULT 0 COMMENT '记录连续签到天数',
        `date` varchar(200) NOT NULL COMMENT '最近签到日期',
        `month` varchar(200) NOT NULL COMMENT '签到月份',
        `day` varchar(255) DEFAULT NULL COMMENT '当月签到汇总 数组形式',
        `status` tinyint(1) DEFAULT 0 COMMENT '领取每月奖励状态',
        PRIMARY KEY (`id`),
        KEY `idx_weid` (`weid`),
        KEY `idx_uid` (`uid`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户签到记录表';




    CREATE TABLE IF NOT EXISTS `ims_goouc_class_usercard`(
    		`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    		`weid` int(11) NOT NULL,
    		`uid` int(255) NOT NULL COMMENT '用户id',
    		`sonid` int(11) NOT NULL COMMENt '章节id',
    		`createtime` int(11) NOT NULL,
    		PRIMARY KEY (`id`),
        KEY `idx_weid` (`weid`),
        KEY `idx_uid` (`uid`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户使用听课券记录';

    CREATE TABLE IF NOT EXISTS `ims_goouc_class_userlook`(
    		`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    		`weid` int(11) NOT NULL,
    		`uid` int(255) NOT NULL COMMENT '用户id',
    		`date` int(11) NOT NULL COMMENt '每周日期',
    		`time` int(11) NOT NULL COMMENT '本周观看时长',
    		`num` int(11) DEFAULT 0 COMMENT '本周领取晓禾币次数',
    		PRIMARY KEY (`id`),
        KEY `idx_weid` (`weid`),
        KEY `idx_uid` (`uid`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户每周观看视频时常';




    CREATE TABLE IF NOT EXISTS `ims_goouc_class_usershar`(
    		`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    		`weid` int(11) NOT NULL,
    		`uid` int(255) NOT NULL COMMENT '用户id',
    		`buid` int(255) NOT NULL COMMENT '被分享者id',
    		`date` int(11) NOT NULL COMMENT '分享日期',
    		`num` tinyint(2) DEFAULT 0 COMMENT '分享成功次数',
        `cardnum` int(11) DEFAULT 0 ,
    		PRIMARY KEY (`id`),
        KEY `idx_weid` (`weid`),
        KEY `idx_uid` (`uid`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户分享记录';

    CREATE TABLE IF NOT EXISTS `ims_goouc_class_banner`(
    		`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    		`weid` int(11) NOT NULL,
    		`title` varchar(255) NOT NULL COMMENT 'title',
    		`status` tinyint(4) DEFAULT 0 COMMENT '状态值 1显示 0不显示',
    		`image` varchar(255) NOT NULL COMMENT '图片路径',
    		`position` tinyint(4) DEFAULT 1 COMMENT '发布位置 1小程序端  2  PC端',
    		`type` tinyint(2) DEFAULT NULL COMMENT '跳转方式',
    		`link` varchar(255) DEFAULT NULL COMMENT '跳转路径',
    		`listorder` tinyint(4) DEFAULT 0 COMMENT '排序 越大 越靠前',
    		`createtime` int(11) NOT NULL COMMENT '创建时间',
            `classid` varchar(255) DEFAULT null COMMENT '对应课程id',
    		PRIMARY KEY (`id`),
        KEY `idx_weid` (`weid`),
        KEY `idx_classid` (`classid`),
        KEY `idx_position` (`position`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '轮播图';

    CREATE TABLE IF NOT EXISTS `ims_goouc_class_payment`(
    		`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    		`weid` int(11) NOT NULL,
    		`type` tinyint(4) NOT NULL COMMENT '购买类型 1 课程 2 单章节',
    		`lessonid` int(11)  DEFAULT NULL COMMENT '课程id',
    		`sonid` int(11) DEFAULT NULL COMMENT '章节id',
    		`uid` int(11)  NOT NULL COMMENT '购买者的uid',
    		`openid` varchar(255) NOT NULL COMMENT '购买者的openid',
    		`pay_money` decimal(10,2) NOT NULL COMMENT '支付金额',
    		`out_trade_no` varchar(255) NOT NULL COMMENT '后台生成的随机订单号',
    		`create_time` int(11) NOT NULL COMMENT '订单创建时间',
    		`order_status` TINYINT(4) DEFAULT 0 COMMENT '订单状态 0 未完成 1完成 ',
    		`transaction_id` varchar(255) DEFAULT NULL COMMENT '微信服务器返回的订单号',
    		`compltet_time` int(11) DEFAULT NULL COMMENT '订单完成时间',
    		PRIMARY KEY (`id`),
    		INDEX (`openid`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '支付订单表';
    
    CREATE TABLE IF NOT EXISTS `ims_goouc_class_stady`(
    		`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    		`weid` int(11) NOT NULL,
    		`sonid` int(11) DEFAULT NULL COMMENT '章节id',
    		`uid` int(11)  NOT NULL COMMENT '购买者的uid',
    		`create_time` int(11) NOT NULL COMMENT '订单创建时间',
    		PRIMARY KEY (`id`),
        KEY `idx_uid` (`uid`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '已学习';
    
    CREATE TABLE IF NOT EXISTS `ims_goouc_class_userlookm`(
    		`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    		`weid` int(11) NOT NULL,
    		`uid` int(255) NOT NULL COMMENT '用户id',
    		`date` int(11) NOT NULL COMMENt '每月日期',
    		`time` int(11) NOT NULL COMMENT '本月观看时长',
    		PRIMARY KEY (`id`),
        KEY `idx_uid` (`uid`),
        KEY `idx_weid` (`weid`),
        KEY `idx_date` (`date`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户月观看视频时常';

    CREATE TABLE IF NOT EXISTS `ims_goouc_class_pcsetting`(
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(11) not null,
            `title` varchar(255) NOT NULL,
            `pc_appid` varchar(255) DEFAULT NULL,
            `pc_secret` varchar(255) DEFAULT NULL,
            `icon` VARCHAR (255) DEFAULT NULL,
            `keywords` VARCHAR (255) DEFAULT NULL,
            `logo_title` VARCHAR (255) DEFAULT NULL,
            `logo` VARCHAR (255) DEFAULT NULL,
            `description` VARCHAR (255) DEFAULT NULL,
            `qq` int(15) DEFAULT NULL,
            `phone` int(20) DEFAULT NULL,
            `keepon` VARCHAR(255) DEFAULT NULL,
            `qrcode` VARCHAR(255) DEFAULT NULL,
            `xqrcode` varchar(255)  DEFAULT NULL COMMENT '网站小程序码' ,
            `address` varchar(255)  DEFAULT NULL ,
            PRIMARY KEY (`id`)
        )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='PC网站设置表';
        
        DROP TABLE IF EXISTS `ims_goouc_class_order`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_order`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `type` int(11) NOT NULL COMMENT '购买类型 1原价购买 2开团购买 3参团购买 4 使用兑课券购买',
          `out_trade_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
          `userid` int(11) NOT NULL,
          `openid` varchar(255) NULL COMMENT '购买者的openid',
          `order_status` tinyint(1) NOT NULL COMMENT '订单状态 0未支付1已支付2已退款',
          `all_money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '总金额',
          `true_money` decimal(10, 2) NOT NULL COMMENT '实付款',
          `createtime` int(11) NOT NULL,
          `paytime` int(11) NULL DEFAULT NULL,
          `msg` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
          `dataid` int(11) NULL DEFAULT NULL,
          `usercardid` int(11) NULL DEFAULT NULL,
          `groupid` int(11) NULL DEFAULT 0 COMMENT '0 开团  其他为参团id',
          `transaction_sn` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方流水号',
          `module` TINYINT(1) NOT NULL COMMENT '区分模块',
          `refundtime`  int(11) NULL DEFAULT 0 COMMENT '退款时间' ,
          PRIMARY KEY (`id`),
          KEY `idx_weid` (`weid`),
          KEY `idx_out_trade_no` (`out_trade_no`),
          KEY `idx_transaction_sn` (`transaction_sn`),
          KEY `idx_dataid` (`dataid`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

        CREATE TABLE IF NOT EXISTS `ims_goouc_class_cardinfo`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `price` decimal(10,2) NOT NULL COMMENT '兑课券抵用金额',
          `condition` int(11) NOT NULL COMMENT '使用兑课券的条件 满金额',
          `status` tinyint(1) DEFAULT 0,
          `createtime` int(11) NOT NULL,
          `order` int(4) DEFAULT 0,
          `desc` text DEFAULT NULL COMMENT '兑课券使用说明',
          `end_time` int(11) DEFAULT 30 COMMENT '兑课券有效期 默认30天',
          `need` int(11) NOT NULL COMMENT \"兑换兑课券需要的晓禾币数量\",
           PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

        CREATE TABLE IF NOT EXISTS `ims_goouc_class_level`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `name` varchar(255) NOT NULL,
          `time` int(11) NOT NULL,
          `status` tinyint(1) DEFAULT 0,
          `addtime` int(11) NOT NULL,
          `order` int(4) DEFAULT 0,
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

        CREATE TABLE IF NOT EXISTS `ims_goouc_class_poster`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `title` varchar(255) NOT NULL COMMENT '分享海报的标题',
          `image` varchar(255) NOT NULL COMMENT '海报背景图 不能为空',
          `createtime` int(11) NOT NULL COMMENT '创建时间',
          `status` tinyint(1) DEFAULT 0,
          `order` int(4) DEFAULT 0,
          `position` tinyint(4) DEFAULT 1 COMMENT '背景图位置',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

        CREATE TABLE IF NOT EXISTS `ims_goouc_class_shartitle`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `selected` varchar(255) DEFAULT NULL COMMENT '首页分享标题',
          `mine` varchar(255) DEFAULT NULL COMMENT '个人中心分享标题',
          `ranking` varchar(255) DEFAULT NULL COMMENT '排行榜分享标题',
          `ranking_detail` varchar(255) DEFAULT NULL COMMENT '完善信息分享标题',
          `myday` varchar(255) DEFAULT NULL COMMENT '签到分享标题',
          `rechange` varchar(255) DEFAULT NULL COMMENT '购买页面分享标题',
          `consultation` varchar(255) DEFAULT NULL COMMENT '咨询分享标题',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
        
         CREATE TABLE IF NOT EXISTS `ims_goouc_class_type_status`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `name` varchar(255) NOT NULL ,
          `status` tinyint(1) DEFAULT 0 ,
          `position` tinyint(1) DEFAULT 1,
          `type` tinyint(1) NOT NULL,
          `image` varchar(255) NOT NULL,
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
        
        DROP TABLE IF EXISTS `ims_goouc_class_classtype`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_classtype`(
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `weid` int(11) NOT NULL,
            `name` varchar(255) NOT NULL COMMENT '班型名称',
            `order` int(11) NOT NULL COMMENt '排序',
            `status` tinyint(1) NOT NULL COMMENT '状态',
            `addtime` int(11) NOT NULL COMMENT '添加时间',
            PRIMARY KEY (`id`)
        )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '班型设置表';
        
        DROP TABLE IF EXISTS `ims_goouc_class_poster_new`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_poster_new`(
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `weid` int(11) NOT NULL,
            `bgimg` varchar(255) NOT NULL COMMENT '海报背景图片',
            `option` varchar(255) NOT NULL COMMENT '海报选择开启的选项',
            `qrcode_left_px` int(11) DEFAULT NULL COMMENT '二维码左边距',
            `qrcode_top_px` int(11) DEFAULT NULL COMMENT '二维码上边距',
            `qrcode_width_px` int(11) DEFAULT NULL COMMENT '二维码宽度',
            `qrcode_height_px` int(11) DEFAULT NULL COMMENT '二维码高度',
            `head_left_px` int(11) DEFAULT NULL COMMENT '用户头像左边距',
            `head_top_px` int(11) DEFAULT NULL COMMENT '用户头像上边距',
            `head_width_px` int(11) DEFAULT NULL COMMENT '用户头像宽度',
            `head_height_px` int(11) DEFAULT NULL COMMENT '用户头像高度',
            `nick_left_px` int(11) DEFAULT NULL COMMENT '用户昵称左边距',
            `nick_top_px` int(11) DEFAULT NULL COMMENT '用户昵称上边距',
            `nick_size_px` int(11) DEFAULT NULL COMMENT '用户昵称字体大小',
            `nick_font_color` varchar(7) DEFAULT NULL COMMENT '用户昵称字体颜色',
            `study_day_left_px` int(11) DEFAULT NULL COMMENT '学习天数左边距',
            `study_day_top_px` int(11) DEFAULT NULL COMMENT '学习天数上边距',
            `study_day_size_px` int(11) DEFAULT NULL COMMENT '学习天数字体大小',
            `study_day_font_color` varchar(7) DEFAULT NULL COMMENT '学习天数字体颜色',
            `date_left_px` int(11) DEFAULT NULL COMMENT '当前日期左边距',
            `date_top_px` int(11) DEFAULT NULL COMMENT '当前日期上边距',
            `date_size_px` int(11) DEFAULT NULL COMMENT '当前日期字体提大小',
            `date_font_color` varchar(7) DEFAULT NULL COMMENT '当前日期字体颜色',
            `status` tinyint(1) NOT NULL COMMENT '状态 1 启用 2 未启用',
            `addtime` int(11) NOT NULL COMMENT '添加时间',
            `poster`  varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '海报预览图' ,
            PRIMARY KEY (`id`)
        )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '海报设置表';
        
        DROP TABLE IF EXISTS `ims_goouc_class_user_exchange`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_user_exchange`(
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `weid` int(11) NOT NULL,
            `uid` int(11) NOT NULL COMMENT '用户id',
            `cid` int(11) NOT NULL COMMENT '兑课券id',
            `status` tinyint(1) NOT NULL COMMENT '使用状态状态 1已使用 2 未使用',
            `year` int(11) NOT NULL COMMENT '兑换年份',
            `addtime` int(11) NOT NULL COMMENT '兑换时间',
            PRIMARY KEY (`id`)
        )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户兑课券表';
        
        DROP TABLE IF EXISTS `ims_goouc_class_user_group`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_user_group`(
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `weid` int(11) NOT NULL,
            `uid` int(11) NOT NULL COMMENT '用户id',
            `lessonid` int(11) NOT NULL COMMENT '课程id',
            `groupnum` int(11) DEFAULT 1 COMMENT '团人数',
            `status` tinyint(1) DEFAULT 2 COMMENT '团状态 默认1 拼团成功 2 拼团未完成 3团已过期',
            `createtime` int(11)  NOT NULL COMMENT '开团时间',
            `refund_status`  tinyint(1) NULL DEFAULT 2 COMMENT '1:已退款   2：未退款' ,
            PRIMARY KEY (`id`)
        )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户开团表';
        
        DROP TABLE IF EXISTS `ims_goouc_class_user_group_info`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_user_group_info`(
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `weid` int(11) NOT NULL,
            `groupid` int(11) NOT NULL COMMENT '团ID',
            `uid` int(11) NOT NULL COMMENT '用户id',
            `isgrouper` tinyint(1) DEFAULT 1 COMMENT '默认是团长',
            `lessonid` int(11) NOT NULL COMMENT '课程id',
            `createtime` int(11)  NOT NULL COMMENT '参团时间',
            `out_trade_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 
            `refund_status`  tinyint(1) NULL DEFAULT 2 COMMENT '1:已退款   2：未退款' ,
            `refund_time`  int(11) NULL DEFAULT 0 COMMENT '退款时间' ,
            PRIMARY KEY (`id`)
        )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户参团表';
        
        DROP TABLE IF EXISTS `ims_goouc_class_user_study_speed`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_user_study_speed`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `uid` int(11) NOT NULL,
          `lessonid` int(11) NOT NULL,
          `sonid` int(11) NOT null,
          `speed` int(11) NOT NULL COMMENT '当前章节学习到的进度',
          `study_time` int(11) NOT NULL,
          PRIMARY KEY (`id`),
          KEY `idx_weid` (`weid`),
          KEY `idx_uid` (`uid`),
          KEY `idx_lessonid` (`lessonid`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
        
        DROP TABLE IF EXISTS `ims_goouc_class_live_message`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_live_message`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `uid` int(11) NOT NULL,
          `sonid` int(11) NOT NULL,
          `content` text  CHARACTER SET utf8mb4 DEFAULT NULL,
          `name` text CHARACTER SET utf8mb4 DEFAULT NULL,
          `size` varchar(255) DEFAULT NULL,
          `createtime` int(11) NOT null,
          `type`  tinyint(1) NULL DEFAULT 0 COMMENT '0:data  1:img 3:title' ,
          PRIMARY KEY (`id`),
          KEY `idx_weid` (`weid`),
          KEY `idx_uid` (`uid`),
          KEY `idx_sonid` (`sonid`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
        
        DROP TABLE IF EXISTS `ims_goouc_class_user_study_sign`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_user_study_sign`  (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `weid` int(11) NOT NULL,
          `uid` int(11) NOT NULL,
          `sonid` int(11) NOT NULL,
          `createtime` int(11) NOT null,
          `status` tinyint(1) DEFAULT 2,
          PRIMARY KEY (`id`),
          KEY `idx_weid` (`weid`),
          KEY `idx_uid` (`uid`),
          KEY `idx_sonid` (`sonid`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
        
         DROP TABLE IF EXISTS `ims_goouc_class_user_signup`;
         CREATE TABLE IF NOT EXISTS `ims_goouc_class_user_signup`(
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `weid` int(11) NOT NULL,
            `uid` int(11) NOT NULL COMMENT '报名用户id',
            `lessonid` int(11) NOT NULL COMMENT '报名课程id',
            `type` tinyint(1) DEFAULT 2 COMMENT '2免费 3晓禾币 4全款付费 5团购付费',
            `xhbnumber` int(11) DEFAULT 0 COMMENT '用户消耗晓禾币数量',
            `pay_money` decimal(10,2) DEFAULT '0.00' COMMENT '用户全款购买的价格',
            `old_money` decimal(10,2) DEFAULT '0.00' COMMENT '团购价格',
            `createtime` int(11) NOT NULL COMMENT '报名时间',
            PRIMARY KEY (`id`),
            KEY `idx_uid` (`uid`),
            KEY `idx_lessonid` (`lessonid`)
        )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '用户报名课程记录表 记录用户报名的免费课程 扣除晓禾币后报名的课程 购买的完成的课程';
        
        DROP TABLE IF EXISTS `ims_goouc_class_user_token`;
        CREATE TABLE `ims_goouc_class_user_token` (
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `weid` int(11) NOT NULL,
            `uid` int(11) NOT NULL,
            `token` varchar(255) NOT NULL COMMENT 'token',
            `createtime` int(11) NOT NULL,
            PRIMARY KEY (`id`)
          ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户访问接口token表';
          
        DROP TABLE IF EXISTS `ims_goouc_class_category`;
        CREATE TABLE IF NOT EXISTS `ims_goouc_class_category` (
           `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
           `weid` int(11) NOT NULL ,
           `name` varchar(255) NOT NULL ,
           `order` int(11) DEFAULT 0 ,
           `createtime` int(10) NOT NULL ,
           `status`  tinyint(1) DEFAULT 0 ,	
           PRIMARY KEY (`id`),
           KEY `idx_weid` (`weid`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='文章分类';
		
		DROP TABLE IF EXISTS `ims_goouc_class_article`;
		CREATE TABLE IF NOT EXISTS `ims_goouc_class_article` (
			  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			  `weid` int(11) NOT NULL ,
			  `cid` int(11) NOT NULL ,
			  `title` VARCHAR(255) NOT NULL,
			  `content` text DEFAULT NULL,
			  `image` VARCHAR(255) DEFAULT NULL,
			  `looknum` int(11) DEFAULT 0,
			  `order` int(11) DEFAULT 0 ,
			  `recommond` tinyint(1) DEFAULT 0 ,
			  `status` tinyint(1) DEFAULT 0,
			  `createtime` int(10) NOT NULL ,	
			  PRIMARY KEY (`id`),
        	  KEY `idx_weid` (`weid`)
		) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='文章列表';


    DROP TABLE IF EXISTS `ims_goouc_class_lesson_underline_student`;
    CREATE TABLE IF NOT EXISTS `ims_goouc_class_lesson_underline_student`(
       `id` int(11) NOT NULL AUTO_INCREMENT,
       `weid` int(11) not null,
       `phone` varchar(11) NOT NULL,
       `username` varchar(32) NOT NULL,
       `lesson_id` int(11) NOT NULL COMMENT '课程id',
       `createtime` int(11) NOT NULL,
       PRIMARY KEY (`id`),
       KEY `idx_phone` (`phone`)
    )ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT = '线下学员名单';
    
    DROP TABLE IF EXISTS `ims_goouc_class_practice`;
    CREATE TABLE `ims_goouc_class_practice` (
            `id`  bigint(20) NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NULL DEFAULT 0 COMMENT '店铺id' ,
            `lessonid`  int(11) NULL DEFAULT 0 COMMENT '课程id' ,
            `sonid`  int(11) NULL DEFAULT 0 COMMENT '章节id' ,
            `type`  tinyint(1) NULL DEFAULT 0 COMMENT '题型：1 判断 2单选 3多选 4 填空  5 解答' ,
            `question`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '问题' ,
            `thumb`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '问题图片' ,
            `answer`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '答案' ,
            `items`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '所有选项' ,
            `img_items`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '所有图片选项' ,
            `analysis`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '讲解' ,
            `fansnum`  int(11) NULL DEFAULT 0 COMMENT '多少人做过' ,
            `correctnum`  int(11) NULL DEFAULT 0 COMMENT '多少人正确' ,
            `status`  tinyint(1) NULL DEFAULT 1 COMMENT '1:显示  0：隐藏' ,
            `isimg`  tinyint(1) NULL DEFAULT 0 COMMENT '0:文本  1：图片' ,
            `is_delete`  tinyint(1) NULL DEFAULT 1 COMMENT '1:使用 2：删除' ,
            `sort`  int(11) NULL DEFAULT 0 COMMENT '排序' ,
            PRIMARY KEY (`id`),
            INDEX `idx_type` (`type`) USING BTREE ,
            INDEX `idx_weid` (`weid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            COMMENT='试题列表'
            AUTO_INCREMENT=1
            ROW_FORMAT=COMPACT
            ;
    
    DROP TABLE IF EXISTS `ims_goouc_class_practice_record`;
    CREATE TABLE `ims_goouc_class_practice_record` (
            `id`  int(11) NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NOT NULL DEFAULT 0 COMMENT '店铺id' ,
            `uid`  int(11) NOT NULL DEFAULT 0 COMMENT '会员id' ,
            `lessonid`  int(11) NOT NULL DEFAULT 0 COMMENT '课程id' ,
            `sonid`  int(11) NOT NULL DEFAULT 0 COMMENT '章节id' ,
            `record`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '答题记录' ,
            `createtime`  int(11) NOT NULL DEFAULT 0 COMMENT '时间' ,
            `status`  tinyint(1) NULL DEFAULT 1 COMMENT '1:可以使用   2：隐藏' ,
            `updatetime`  int(11) NULL DEFAULT 0 COMMENT '更新时间' ,
            PRIMARY KEY (`id`),
            INDEX `idx_weid` (`weid`) USING BTREE,
            INDEX `idx_lessonid` (`lessonid`) USING BTREE ,
            INDEX `idx_sonid` (`sonid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            COMMENT='答题记录'
            AUTO_INCREMENT=1
            ROW_FORMAT=COMPACT
            ;
            
    DROP TABLE IF EXISTS `goouc_class_practice_false_record`; 
    CREATE TABLE `ims_goouc_class_practice_false_record` (
            `id`  int(11) NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NOT NULL DEFAULT 0 COMMENT '店铺id' ,
            `uid`  int(11) NOT NULL DEFAULT 0 COMMENT '会员id' ,
            `lessonid`  int(11) NOT NULL DEFAULT 0 COMMENT '课程id' ,
            `sonid`  int(11) NOT NULL DEFAULT 0 COMMENT '章节id' ,
            `practiceid`  int(11) NOT NULL DEFAULT 0 COMMENT '习题id' ,
            `answer`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '正确答案' ,
            `useranswer`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '学员答案' ,
            `createtime`  int(11) NOT NULL DEFAULT 0 COMMENT '时间' ,
            `is_delete`  tinyint(1) NOT NULL DEFAULT 1 COMMENT '1:使用  2：删除' ,
            PRIMARY KEY (`id`),
            INDEX `idx_weid` (`weid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            COMMENT='错题本'
            AUTO_INCREMENT=1
            ROW_FORMAT=COMPACT
            ; 
            
    DROP TABLE IF EXISTS `ims_goouc_class_user_star`; 
    CREATE TABLE `ims_goouc_class_user_star` (
            `id`  int(11) NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NULL DEFAULT 0 COMMENT '店铺id' ,
            `uid`  int(11) NOT NULL DEFAULT 0 COMMENT '会员id' ,
            `lessonid`  int(11) NOT NULL DEFAULT 0 COMMENT '课程id' ,
            `sonid`  int(11) NOT NULL DEFAULT 0 COMMENT '章节id' ,
            `num`  int(1) NOT NULL DEFAULT 0 COMMENT '星星数量' ,
            `createtime`  int(11) NOT NULL DEFAULT 0 ,
             `status`  tinyint(1) NULL DEFAULT 1 COMMENT '1:可以使用   2：隐藏' ,
            PRIMARY KEY (`id`),
            INDEX `id_weid` (`weid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            COMMENT='会员获取星星数量记录表'
            AUTO_INCREMENT=1
            ROW_FORMAT=COMPACT
            ;   
    DROP TABLE IF EXISTS `ims_goouc_class_live_record`; 
    CREATE TABLE `ims_goouc_class_live_record` (
            `id`  int(11) UNSIGNED NOT NULL AUTO_INCREMENT ,
            `sonid`  int(11) NOT NULL DEFAULT 0 COMMENT '章节id' ,
            `stream`  varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '直播码' ,
            `app`  varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '频道名' ,
            `weid`  int(11) NULL DEFAULT 0 COMMENT '店铺id' ,
            `ctime`  int(11) NOT NULL DEFAULT 0 COMMENT '创建时间' ,
            `utime`  int(11) NOT NULL DEFAULT 0 COMMENT '修改时间' ,
            `flv`  varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ,
            `mp4`  varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ,
            `m3u8`  varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ,
            `duration`  int(11) NOT NULL DEFAULT 0 COMMENT '录制时间 秒' ,
            `start_time`  int(11) NOT NULL DEFAULT 0 COMMENT '开始时间' ,
            `stop_time`  int(11) NOT NULL DEFAULT 0 COMMENT '结束时间' ,
            `domain`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '播流域名' ,
            PRIMARY KEY (`id`),
            INDEX `idx_sonid` (`sonid`) USING BTREE ,
            INDEX `idx_weid` (`weid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
            COMMENT='直播录制视频'
            AUTO_INCREMENT=1
            ROW_FORMAT=COMPACT
            ;      
            
    DROP TABLE IF EXISTS `ims_goouc_class_teacher_task`; 
    CREATE TABLE `ims_goouc_class_teacher_task` (
            `id`  int(11) UNSIGNED NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NOT NULL DEFAULT 0 COMMENT '店铺id' ,
            `uid`  int(11) NOT NULL DEFAULT 0 COMMENT '教师uid' ,
            `teacherid`  int(11) NOT NULL DEFAULT 0 COMMENT '教师表uid' ,
            `lessonid`  int(11) NOT NULL DEFAULT 0 COMMENT '课程id' ,
            `sonid`  varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '章节id序列' ,
            `studentid`  varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '学生id序列' ,
            `totalstudent`  int(8) NOT NULL DEFAULT 0 COMMENT '总学生数' ,
            `totalson`  int(3) NOT NULL DEFAULT 0 COMMENT '总章节数' ,
            `endtime`  int(11) NOT NULL DEFAULT 0 COMMENT '截止时间' ,
            `title`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '作业标题' ,
            `message`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文本消息' ,
            `createtime`  int(11) NOT NULL DEFAULT 0 COMMENT '创建时间' ,
            `datetime`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '日期' ,
            PRIMARY KEY (`id`),
            INDEX `idx_weid` (`weid`) USING BTREE ,
            INDEX `idx_lessonid` (`lessonid`) USING BTREE ,
            INDEX `idx_uid` (`uid`) USING BTREE 
            )
            ENGINE=MyISAM
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            AUTO_INCREMENT=2
            CHECKSUM=0
            ROW_FORMAT=DYNAMIC
            DELAY_KEY_WRITE=0
            ;  
    DROP TABLE IF EXISTS `ims_goouc_class_user_son_time`;
    CREATE TABLE `ims_goouc_class_user_son_time` (
            `id`  int(11) NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NOT NULL DEFAULT 0 COMMENT '店铺id' ,
            `uid`  int(11) NOT NULL DEFAULT 0 COMMENT '用户uid' ,
            `sonid`  int(11) NOT NULL DEFAULT 0 COMMENT '章节id' ,
            `time`  int(11) NOT NULL DEFAULT 0 COMMENT '观看时长' ,
            `createtime`  int(11) NOT NULL DEFAULT 0 COMMENT '时间' ,
            PRIMARY KEY (`id`),
            INDEX `idx_weid` (`weid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            COMMENT='用户学习时长记录表'
            AUTO_INCREMENT=1
            ROW_FORMAT=DYNAMIC
            ;
    DROP TABLE IF EXISTS `ims_goouc_class_jg_room`;        
    CREATE TABLE `ims_goouc_class_jg_room` (
            `id`  int(11) NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NOT NULL DEFAULT 0 COMMENT '店铺id' ,
            `sonid`  int(11) NOT NULL DEFAULT 0 COMMENT '章节id' ,
            `roomid`  int(20) NOT NULL DEFAULT 0 COMMENT '聊天室id' ,
            `ctime`  int(11) NULL DEFAULT 0 COMMENT '创建时间' ,
            PRIMARY KEY (`id`),
            INDEX `idx_weid` (`weid`) USING BTREE ,
            INDEX `idx_sonid` (`sonid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            COMMENT='极光聊天室列表'
            AUTO_INCREMENT=1
            ROW_FORMAT=DYNAMIC
            ;
    DROP TABLE IF EXISTS `ims_goouc_class_jg_user`; 
    CREATE TABLE `ims_goouc_class_jg_user` (
            `id`  int(11) NOT NULL AUTO_INCREMENT ,
            `weid`  int(11) NOT NULL DEFAULT 0 COMMENT '店铺id' ,
            `uid`  int(11) NOT NULL DEFAULT 0 COMMENT '用户id' ,
            `username`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'jm用户名' ,
            `password`  int(6) NOT NULL DEFAULT 0 COMMENT '密码' ,
            `ctime`  int(11) NULL DEFAULT 0 COMMENT '创建时间' ,
            PRIMARY KEY (`id`),
            INDEX `idx_uid` (`uid`) USING BTREE ,
            INDEX `idx_weid` (`weid`) USING BTREE 
            )
            ENGINE=InnoDB
            DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
            COMMENT='极光用户表（可以进聊天室的）'
            AUTO_INCREMENT=8
            ROW_FORMAT=DYNAMIC
            ;

	";
pdo_run($sql);


?>